帖子列表页获取封面图片_discuz二次开发教程
source/module/forum/forum_forumdisplay.php
大于809行找到如下代码
if($thread['rushreply']) {
$rushtids[$thread['tid']] = $thread['tid'];
}
在这段代码下面添加如下代码:
$threada= C::t('forum_attachment')->fetch_all_by_id('tid', $thread['tid'], 'aid');
$threadaid = reset($threada);
$threadpic = C::t('forum_attachment_n')->fetch_by_aid_uid($threadaid['tableid'], $threadaid['aid'], $thread['authorid']);
$thread['pic'] = $threadpic['attachment'];
这样就可以在列表页模板中使用
$thread['pic']
来加载一张封面图片,但是需要注意这样是加载最后一张插入的图片!
如果要改为第一张图片还需要修改另外的一个文件
找到文件
source/class/table/table_forum_announcement.php
找到
$orderby = 'ORDER BY '.DB::order($orderby, 'DESC');
修改为:
$orderby = 'ORDER BY '.DB::order($orderby, 'ASC');
好了这样就可在列表页,加载发帖时上传的第一张图片,做为封面来调用了!
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jz/discuz/3321.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
Discuz x2.5 伪静态规则成功
时间:2020-12-29
-
discuz X2正式版forum首页的
时间:2020-12-27
-
Discuz伪静态 配置搜索引擎
时间:2020-12-26
-
Discuz登录后总是显示未登
时间:2020-12-23
-
怎么换云服务器? Discuz论坛
时间:2020-12-23
-
Discuz!7.0主题回收站功能详
时间:2020-12-23
-
discuz 修改创始人密码、管
时间:2020-12-23
-
discuz论坛用户通过邮件验
时间:2020-12-23
热门文章
-
去掉discuz列表页的最新公告_Discuz模板开发
时间:2020-12-13
-
修改discuz X3.2论坛标题80个字符的长度限制
时间:2020-12-14
-
discuz 修改创始人密码、管理员登录密码的
时间:2020-12-23
-
discuz主题内容页面的打印按钮代码
时间:2020-12-13
-
Discuz!7.0主题回收站功能详解
时间:2020-12-23
-
footer.htm底部文件$_G['setting']['icp']、{if $
时间:2020-12-13
-
discuz教程_discuz视频教程_discuz论坛模板制
时间:2020-12-14
-
$article['related']Discuz 门户文章内容页的相
时间:2020-12-13
-
discuz教程_discuz视频教程_discuz论坛模板制
时间:2020-12-14
-
Discuz教程:使用微信登陆出现“目前无法
时间:2020-12-15
